﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DonHang.aspx.cs" Inherits="ThoiTrangT2B.Admin.DonHang"
    MasterPageFile="~/Admin/AdminSite.Master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="NoiDungChinh">
        <img class="FormImage" src="images/computer.png" />
        <p class="FormTitle" id="FormTitle" runat="server">
            Quản lý Đơn hàng</p>
    </div>
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="formUpdate" runat="server">
            <div class="Form Update">
                <p class="DeMucTable">
                    Thông tin khách hàng</p>
                <style>
                    *
                    {
                        font-weight: bold;
                    }
                    .Max th
                    {
                        text-align: left;
                        width: 20%;
                    }
                </style>
                <table border="1px" class="ListForm Max" style="width: 100%">
                    <tr>
                        <th>
                            Họ tên :
                        </th>
                        <td>
                            <asp:Label ID="lblHoTen" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Email :
                        </th>
                        <td>
                            <asp:Label ID="lblEmail" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Số điện thoại :
                        </th>
                        <td>
                            <asp:Label ID="lblSDT" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Địa chỉ :
                        </th>
                        <td>
                            <asp:Label ID="lblDiaChi" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Ghi chú :
                        </th>
                        <td>
                            <asp:Label ID="lblGhiChu" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                </table>
                <br />
                <p class="DeMucTable">
                    Thông tin Giỏ hàng</p>
                <asp:GridView ID="grvGioHang" runat="server" AutoGenerateColumns="False" CssClass="ListTable"
                    DataKeyNames="ID" OnRowDataBound="grvGioHang_RowDataBound">
                    <Columns>
                        <asp:TemplateField HeaderText="Tên sản phẩm">
                            <ItemTemplate>
                                <%# Eval("TenSP") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số lượng">
                            <ItemTemplate>
                                <%# Eval("SL")+" chiếc" %>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Giá">
                            <ItemTemplate>
                                <%# Convert.ToInt32(Eval("Gia")).ToString("###,###") + " VNĐ"%>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Thành tiền">
                            <ItemTemplate>
                                <%# Convert.ToInt32(Eval("ThanhTien")).ToString("###,###")%>
                                VNĐ
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <p style="font-weight: bold; padding: 3px 10px; text-align: right">
                    Tổng thành tiền: <font color="red">
                        <asp:Label ID="lblTotal" runat="server" Text=""></asp:Label></font></p>
                <p class="DeMucTable">
                    Cập nhật đơn hàng</p>
                <table border="1px" class="ListForm Max" style="width: 100%">
                    <tr>
                        <th>
                            Trạng thái đơn hàng hiện tại :
                        </th>
                        <td>
                            <asp:Literal ID="lblTrangThai" runat="server"></asp:Literal>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            Cập nhật trạng thái
                        </th>
                        <td>
                            <font color="red">
                                <asp:RadioButton ID="rbtTMoi" runat="server" GroupName="rbt" Text="Đơn hàng mới" /></font>
                            <br />
                            <font color="orange">
                                <asp:RadioButton ID="rbtTCho" runat="server" GroupName="rbt" Text="Đang chờ xử lý" /></font>
                            <br />
                            <font color="green">
                                <asp:RadioButton ID="rbtTXong" runat="server" GroupName="rbt" Text="Đã xử lý xong" /></font>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="btnLuu" runat="server" Text="Cập nhật" CssClass="cmdBtn" OnClick="btnLuu_Click" />
                            <asp:Button ID="btnHuy" runat="server" Text="Hủy" CssClass="cmdBtn" OnClick="btnHuy_Click"
                                CausesValidation="False" />
                        </td>
                    </tr>
                </table>
            </div>
        </asp:View>
        <asp:View ID="formView" runat="server">
            <div class="Form View">
                Lọc theo :
                <asp:RadioButton ID="rbtMoi" runat="server" GroupName="rbt" Text="Đơn hàng mới" AutoPostBack="true"
                    OnCheckedChanged="rbtMoi_CheckedChanged" />
                <asp:RadioButton ID="rbtCho" runat="server" GroupName="rbt" Text="Đơn hàng đang chờ xử lý"
                    AutoPostBack="true" OnCheckedChanged="rbtCho_CheckedChanged" />
                <asp:RadioButton ID="rbtXong" runat="server" GroupName="rbt" Text="Đơn hàng đã xử lý xong"
                    AutoPostBack="true" OnCheckedChanged="rbtXong_CheckedChanged" />
                <asp:GridView ID="grdDanhMuc" runat="server" AutoGenerateColumns="False" CssClass="ListTable"
                    DataKeyNames="ID" OnRowCommand="grdDanhMuc_RowCommand">
                    <Columns>
                        <asp:TemplateField HeaderText="Mã đơn hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblIDDM" runat="server" Text='<%# "#" + Eval("ID") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên khách hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblTenKH" runat="server" Text='<%# Eval("HoTen") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Giá trị đơn hàng">
                            <ItemTemplate>
                                <%# Convert.ToInt32(Eval("ThanhTien")).ToString("###,### VNĐ")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Trạng thái hóa đơn">
                            <ItemTemplate>
                                <%# Convert.ToInt32(Eval("TrangThai"))==0 ? "<font color=Red>Mới</font>" : Convert.ToInt32(Eval("TrangThai"))==1 ? "<font color=Orange>Chờ Xử lý</font>" : "<font color=Green>Đã xử lý xong</font>" %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày đặt hàng">
                            <ItemTemplate>
                                <%# Convert.ToDateTime(Eval("CreateDate")).ToString("dd/MM/yyyy lúc hh:ss")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Xử lý">
                            <ItemTemplate>
                                <asp:ImageButton ID="lbtEdit" runat="server" ImageUrl="../images/edit.gif" CommandName="<%# ThoiTrangT2B.MyConst.Action.Update %>"
                                    CommandArgument='<%# Eval("ID") %>'></asp:ImageButton>
                            </ItemTemplate>
                            <ItemStyle Width="10px" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Xóa">
                            <ItemTemplate>
                                <asp:ImageButton ID="lbtDelete" runat="server" ImageUrl="../images/del.png" CommandName="<%# ThoiTrangT2B.MyConst.Action.Delete %>"
                                    OnClientClick="return confirm('Bạn có chắc là muốn xóa bản ghi này không ?')"
                                    CommandArgument='<%# Eval("ID") %>'></asp:ImageButton>
                            </ItemTemplate>
                            <ItemStyle Width="10px" HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </asp:View>
    </asp:MultiView>
</asp:Content>
